package net.qhzw.vip.qiyu.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 网关白名单配置
 */
@Component
@ConfigurationProperties(prefix = "security.ignore")
public class IgnoreUrlsConfig {

    private List<String> urls;

    public IgnoreUrlsConfig(List<String> urls) {
        this.urls = urls;
    }

    public IgnoreUrlsConfig() {
    }

    public void setUrls(List<String> urls) {
        this.urls = new ArrayList<>(urls.size());
        urls.forEach(data -> {
            String uri = data.substring(data.split("/")[1].length() + 1, data.length());
            this.urls.add(uri);
        });
    }

    public List<String> getUrls() {
        return urls;
    }
}